package com._520it.crm.service.impl;

import com._520it.crm.domain.PaymentCheck;
import com._520it.crm.mapper.PaymentCheckMapper;
import com._520it.crm.page.PageResult;
import com._520it.crm.query.PaymentCheckQueryObject;
import com._520it.crm.service.IPaymentCheckService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

@Service
public class PaymentCheckServiceImpl implements IPaymentCheckService {
    @Autowired
    private PaymentCheckMapper paymentCheckMapper;

    @Override
    public PaymentCheck selectByPrimaryKey(Long id) {
        return paymentCheckMapper.selectByPrimaryKey(id);
    }

    @Override
    public PageResult queryPage(PaymentCheckQueryObject qo) {
        Integer total = paymentCheckMapper.queryForCount(qo);
        if(total == 0){
            return new PageResult(0, Collections.EMPTY_LIST);
        }
        List<PaymentCheck> rows = paymentCheckMapper.queryForRows(qo);
        return new PageResult(total,rows);
    }
}
